if [ -n "$1" ]; then
    data_date=$1
else
  data_date=`date -d "-1 day" +%F`
fi

ods_sale_log="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/jtp_gd06_warehouse/ods_sale_log/${data_date}'
OVERWRITE INTO TABLE jtp_gd06_warehouse.ods_sale_log PARTITION (dt='${data_date}');
"
ods_product_log="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/jtp_gd06_warehouse/ods_product_log/${data_date}'
OVERWRITE INTO TABLE jtp_gd06_warehouse.ods_product_log PARTITION (dt='${data_date}');
"
ods_product_dim_tb="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/jtp_gd06_warehouse/ods_product_dim_tb/${data_date}'
OVERWRITE INTO TABLE jtp_gd06_warehouse.ods_product_dim_tb PARTITION (dt='${data_date}');
"
ods_customer_dim_tb="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/jtp_gd06_warehouse/ods_customer_dim_tb/${data_date}'
OVERWRITE INTO TABLE jtp_gd06_warehouse.ods_customer_dim_tb PARTITION (dt='${data_date}');
"
ods_product_type_dim_tb="
LOAD DATA INPATH 'hdfs://node101:8020/warehouse/app_basic/jtp_gd06_warehouse/ods_product_type_dim_tb/${data_date}'
OVERWRITE INTO TABLE jtp_gd06_warehouse.ods_product_type_dim_tb PARTITION (dt='${data_date}');
"

/opt/module/spark/bin/beeline -u jdbc:hive2://node101:10001 -n bwie -e "
${ods_sale_log}
${ods_product_log}
${ods_product_dim_tb}
${ods_customer_dim_tb}
${ods_product_type_dim_tb}
"